﻿$(function () {
    var hiddendusedPoint = $("#hiddendusedPoint").val();
    var hiddendUnusedPoint = $("#hiddendUnusedPoint").val();
    $("#usedPoint").text(hiddendusedPoint);
    $("#unUsedPoint").text(hiddendUnusedPoint);
    $("#btnCloseDialog").live("click", function () { ReferrerDialog.close() });//关闭对话框
    $("#btnBeReferrer").live("click", BeReferrer);//
    //
    var hiddenIsReferrer = $("#hiddenIsReferrer").attr("data-isreferrer");


    if (hiddenIsReferrer!="1")
    {
        var source = $("#BeReferrer_template").html();
        var template = Handlebars.compile(source);
        var html = template();
        ReferrerDialog = art.dialog({
            content: html,
            title: '',
            id: 'ReferrerDialog',
        }).lock();
    }
    
    function BeReferrer() {
        $.ajax({
            url: "../Expand/BeReferrer",
            data: {},
            dataType: "json",
            beforeSend: function () {

            },
            type: "post",
            success: function (result) {
                if (result) {
                    alert("操作成功", function () {
                        ReferrerDialog.close();
                    });
                }
                else {
                    alert("操作失败");
                }
            },
            async: true,
            complete: function () {

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert(errorThrown);
            }
        });
    };

});